<?php
namespace app\home\model;
use think\Model;

class MemberSeekModel extends Model
{
	protected $table  = 'qm_member_seek';



	/**
	*找出用户最近的搜索记录-10条
	*
	**/
	public function getMemberSeekListNumberTen($member_id)
	{
		$info = $this->where('member_id', '=', $member_id)->order('add_time DESC')->limit(0, 10)->select();
		if(!empty($info))
		{
			$info = $info->toArray();
		}

		return $info;
	}



	/**
	*
	*用户是否搜过标题
	*
	**/
	public function checkMemberSeeks($member_id, $name)
	{
		$info = $this->where('member_id', '=', $member_id)->where('name', '=', $name)->find();
		return $info;
	}




	/**
	*
	*增加用户搜索记录
	*
	**/
	public function addMemberSeeks($data)
	{
		$res = $this->insertGetId($data);
		return $res;
	}



	/**
	*
	*清除-所有搜索记录
	*
	**/
	public function delMemberSeek($member_id)
	{
		$res = $this->where('member_id', '=', $member_id)->delete();
		return $res;
	}
}